package com.sisyphus.spinach.ui;

import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import com.sisyphus.spinach.core.INetPageTask;

import androidx.annotation.NonNull;

public class NetTaskRefreshLoadMore<T> implements OnRefreshLoadMoreListener {

    INetPageTask.Presenter<T, INetPageTask.View<T>> presenter;

    public NetTaskRefreshLoadMore(INetPageTask.Presenter<T, INetPageTask.View<T>> presenter) {
        this.presenter = presenter;
    }

    @Override
    public void onLoadMore(@NonNull RefreshLayout refreshLayout) {

        presenter.loadMore();
    }

    @Override
    public void onRefresh(@NonNull RefreshLayout refreshLayout) {

        presenter.refresh();
    }

}
